#include "game_autorelease.h"
#include "game_log.h"

CGameAutorelease g_CGameAutorelease;


void CGameAutorelease::addObject(CGameRef* ref){
  _vec.push_back(ref);
}

void CGameAutorelease::release(){
  
};

BOOL CGameAutorelease::contains(CGameRef* ref) const{
  for(const auto& obj:_vec){
    if(obj == ref)
      return TRUE;
  }

  return FALSE;
}


void CGameAutorelease::dump(){
  CGameLogger* logger = CGameLoggerFactory::getInstance()->getLogger("CGameAutorelease");
  logger->info("CGameAutorelease number of managed object %d",_vec.size());
  for (const auto& obj : _vec){
    logger->info("%20p%20u\n", obj, obj->getReferenceCount());
  }
}
